#ifndef __APP_CTRL_H
#define __APP_CTRL_H
#include "main.h"
#include "bsp_can.h"
#include "bsp_tim.h"
#include "bsp_flash.h"
#include "drv_dm.h"
#include "drv_nrf24l01.h"
#include "drv_m2006.h"

typedef enum {
  emax_13 = ((1 << 13) - 1),    // 8191
  emax_14 = ((1 << 14) - 1),    // 16383
  emax_15 = ((1 << 15) - 1),    // 32767
  emax_16 = ((1 << 16) - 1)     // 65535
} encoded_max_enum;

extern motor_dm_t motor_1;
extern motor_dm_t motor_2;
extern motor_dm_t motor_3;
extern motor_dm_t motor_4;
extern motor_m2006_t motor_5;
extern motor_m2006_t motor_6;
extern uint8_t error;
extern float app_controller_angles[];
extern float app_ctrl_angles[];
extern float app_arm_angles[];
extern uint16_t oid_enco_offset;
// extern uint16_t oid_neg_pi;
// extern uint16_t oid_zero;
// extern uint16_t oid_pos_pi;

uint8_t App_Init_Enable(void);
uint8_t App_MainLoop(void);
void App_GetCurrentAngles(float* result);

#endif
